package com.sunfeng.n6;

/**
 * @author sunfeng
 * @date 2021/04/14 10:51
 **/
public class AccountUnsafe implements Account{


    private Integer balance;

    public AccountUnsafe(Integer balance) {
        this.balance = balance;
    }

    @Override
    public synchronized Integer getBalance() {
        return balance;
    }

    @Override
    public synchronized void withdraw(Integer amount) {
        balance -= amount;
    }
}
